About Wildcards
X-Replace lets you search for text in documents by using the wildcard characters * and ? to replace unknown or variable text. To use wildcards in your search, check the Use wildcards box. (If this box is not checked, any wildcard characters you include in the Find or Replace fields will be treated the same way as any other character.)

Important Notes About Wildcards

  • If the first Find character is a * wildcard, everything from the beginning of a document will be regarded as a match.

  • If the last Find character is a * wildcard and a match is found, it will apply to everything from the first matching character to the end of the document.

  • If the ? character is used in the Replace field, it will not be regarded as a wildcard character. X-Replace simply copies this character unchanged into the document.

  • It's strongly recommended that you check the Make backups box when using wildcards. The combination of characters and wildcards you choose may result in text-matches you hadn't foreseen before running the search.

Using Wildcards

  • The * character can be used to replace a single character or multiple characters. For example, a search for te*s would be matched to tens, testimonials, and teaching adults.

  • The ? character is used to match a single character. For example, a search for te?t? would always find a 5-letter word, and possible matches would be teeth and tests.

As an example, let's assume you want to search an HTML document and replace all instances of the bold tag (<b>) with an italic tag (<i>). Set the Find and Replace fields like this:

Find:
<b>*</b>

Replace:
<i>*</i>

Whatever appears between the two tags will be retained.


You can also use multiple * symbols in both fields:

Find:
The biggest * in the world is * as far as I know.

Replace:
I used to think the biggest * in the world was * but now I know I'm wrong.

X-Replace will match the positions of the text represented by each * character in the Find field and slot it into the position of the corresponding character in the Replace field. For this reason, if the Replace field contains any * characters at all, it must contain exactly the same number as the Find field.


The Replace field doesn't have to contain wildcard characters. As an example:

Find:
Dear *,

Replace:
Dear Customer,

X-Replace will replace any matching text with the exact contents of the Replace field.